package com.neuedu.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.neuedu.entity.Nursecontent;
import com.neuedu.service.NursecontentService;
import com.neuedu.vo.ResultJson;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 护理内容 前端控制器
 * </p>
 *
 * @author wangyu
 * @since 2025-10-22
 */
@RestController
@RequestMapping("/nursecontent")
public class NursecontentController {
    @Resource
    NursecontentService nursecontentService;
    @GetMapping("/list")
    ResultJson<IPage<Nursecontent>> list(Integer pageNo, Integer pageSize, String name) {
        return ResultJson.success(nursecontentService.list(pageNo, pageSize, name));
    }
    @PostMapping("/add")
    ResultJson<Boolean> add(Nursecontent nursecontent) {
        return ResultJson.success(nursecontentService.save(nursecontent), "添加护理成功");
    }
    @PostMapping("/update")
    ResultJson<Boolean> update(Nursecontent nursecontent) {
        return ResultJson.success(nursecontentService.updateById(nursecontent), "修改护理成功");
    }
    @PostMapping("/delete")
    ResultJson<Boolean> delete(Integer id) {
        return ResultJson.success(nursecontentService.removeById(id), "删除护理成功");
    }
    @GetMapping("/getById")
    ResultJson<Nursecontent> getById(Integer id) {
        return ResultJson.success(nursecontentService.getById(id));
    }
    @GetMapping("/check")
    ResultJson<Boolean> check(String field, String value, Integer id) {
        return ResultJson.success(nursecontentService.check(field, value, id));
    }
    @GetMapping("/getList")
    ResultJson<List<Nursecontent>> getList() {
        return ResultJson.success(nursecontentService.getList());
    }
}
